package squareBorderPackage;

import java.util.ArrayList;
import be.kuleuven.cs.som.annotate.Value;

/**
 * An enumaration introducing different directions. In its current form, the
 * class only supports North,South,East,West,Ceiling and Floor.
 * 
 * @version 1.0
 * @author Jessa Bekker and Esther Alberts
 */
@Value
public enum Direction {

	NORTH, SOUTH, EAST, WEST, CEILING, FLOOR;

	/**
	 * Return all the directions in a List.
	 */
	public static ArrayList<Direction> getListOfDirections() {
		ArrayList<Direction> directionsList = new ArrayList<Direction>();
		directionsList.add(Direction.NORTH);
		directionsList.add(Direction.SOUTH);
		directionsList.add(Direction.EAST);
		directionsList.add(Direction.WEST);
		directionsList.add(Direction.CEILING);
		directionsList.add(Direction.FLOOR);
		return directionsList;
	}

	public Direction getOpposite() {
		if (this == Direction.CEILING)
			return Direction.FLOOR;
		if (this == Direction.FLOOR)
			return Direction.CEILING;
		if (this == Direction.NORTH)
			return Direction.SOUTH;
		if (this == Direction.SOUTH)
			return Direction.NORTH;
		if (this == Direction.EAST)
			return Direction.WEST;
		return Direction.EAST;
	}

	/**
	 * Return the number of directions.
	 */
	public static int getNbOfDirections() {
		return getListOfDirections().size();
	}

}
